package com.darren.euc.dao.impl;


import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.darren.euc.dao.ClientClassificationDao;
import com.darren.euc.entity.ClientClassification;


@Repository
public class ClientClassificationDaoImpl extends BaseDaoImpl<ClientClassification, Integer> implements ClientClassificationDao {
	
	@SuppressWarnings("unchecked")
	@Override
	public List<ClientClassification> getAll() {
		Session session = sessionFactory.getCurrentSession();	
		return session.createSQLQuery("select * from euc_client_classification where enable='1' order by display_sequence asc,convert(client_classification_name using gbk) asc;").addEntity(ClientClassification.class).list();
	}
	
	@Override
	public ClientClassification saveOrUpdate(ClientClassification clientClassification){
		Session session = sessionFactory.getCurrentSession();	
		return (ClientClassification) session.merge(clientClassification);
	}

}